package com.lihua.project.taskcenter.core.utils;

import java.util.HashSet;
import java.util.Set;

/**
 * @author lihua
 * @date 2022/3/18 16:32
 * 任务标签处理
 */
public class TaskTagUtils {
    /**获取字符串中的标签*/
    public static Set<String> getTags(String tags){
        HashSet<String> set = new HashSet<>();
        //去除空格
        String replace1 = tags.replace(" ", "");
        //将中文逗号转为英文
        String replace = replace1.replace("，", ",");
        //将标签全部转换为小写
        String toLowerCaseTags = replace.toLowerCase();
        //将标签分割出来
        String[] tag = toLowerCaseTags.split(",");
        for (String s : tag) {
            set.add(s);
        }
        return set;
    }
}
